

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>4. VideoTester.sniffer — Network sniffing and packet manipulation &mdash; VideoTester 0.2 documentation</title>
    
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="shortcut icon" href="_static/VTfavicon.png"/>
    <link rel="top" title="VideoTester 0.2 documentation" href="index.html" />
    <link rel="up" title="Module Reference" href="modules.html" />
    <link rel="next" title="5. VideoTester.video — Raw and coded video manipulation" href="video.html" />
    <link rel="prev" title="3. VideoTester.gstreamer — Video processing with GStreamer bindings" href="gstreamer.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="video.html" title="5. VideoTester.video — Raw and coded video manipulation"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="gstreamer.html" title="3. VideoTester.gstreamer — Video processing with GStreamer bindings"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">VideoTester 0.2 documentation</a> &raquo;</li>
          <li><a href="modules.html" accesskey="U">Module Reference</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-VideoTester.sniffer">
<span id="videotester-sniffer-network-sniffing-and-packet-manipulation"></span><h1>4. <tt class="docutils literal"><span class="pre">VideoTester.sniffer</span></tt> &#8212; Network sniffing and packet manipulation<a class="headerlink" href="#module-VideoTester.sniffer" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="VideoTester.sniffer.RTSPi">
<em class="property">class </em><tt class="descclassname">VideoTester.sniffer.</tt><tt class="descname">RTSPi</tt><big>(</big><em>_pkt=''</em>, <em>post_transform=None</em>, <em>_internal=0</em>, <em>_underlayer=None</em>, <em>**fields</em><big>)</big><a class="headerlink" href="#VideoTester.sniffer.RTSPi" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">scapy.packet.Packet</span></tt></p>
<p><em>RTSP interleaved</em> packet decoder.</p>
</dd></dl>

<dl class="class">
<dt id="VideoTester.sniffer.Sniffer">
<em class="property">class </em><tt class="descclassname">VideoTester.sniffer.</tt><tt class="descname">Sniffer</tt><big>(</big><em>conf</em><big>)</big><a class="headerlink" href="#VideoTester.sniffer.Sniffer" title="Permalink to this definition">¶</a></dt>
<dd><p>Network sniffer and packet parser.</p>
<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.cap">
<tt class="descname">cap</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.cap" title="Permalink to this definition">¶</a></dt>
<dd><p>Capture file.</p>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.clock">
<tt class="descname">clock</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.clock" title="Permalink to this definition">¶</a></dt>
<dd><p>SDP clock attribute.</p>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.conf">
<tt class="descname">conf</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.conf" title="Permalink to this definition">¶</a></dt>
<dd><p>Dictionary of configuration options (see <a class="reference internal" href="core.html#VideoTester.core.Client.conf" title="VideoTester.core.Client.conf"><tt class="xref py py-attr docutils literal"><span class="pre">VideoTester.core.Client.conf</span></tt></a>).</p>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.dport">
<tt class="descname">dport</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.dport" title="Permalink to this definition">¶</a></dt>
<dd><p>RTP destination port (client).</p>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.lengths">
<tt class="descname">lengths</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.lengths" title="Permalink to this definition">¶</a></dt>
<dd><p>List of packet lengths.</p>
</dd></dl>

<dl class="method">
<dt id="VideoTester.sniffer.Sniffer.parsePkts">
<tt class="descname">parsePkts</tt><big>(</big><big>)</big><a class="headerlink" href="#VideoTester.sniffer.Sniffer.parsePkts" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse packets and extract <a class="reference internal" href="#VideoTester.sniffer.Sniffer.lengths" title="VideoTester.sniffer.Sniffer.lengths"><tt class="xref py py-attr docutils literal"><span class="pre">lengths</span></tt></a>, <a class="reference internal" href="#VideoTester.sniffer.Sniffer.times" title="VideoTester.sniffer.Sniffer.times"><tt class="xref py py-attr docutils literal"><span class="pre">times</span></tt></a>, <a class="reference internal" href="#VideoTester.sniffer.Sniffer.sequences" title="VideoTester.sniffer.Sniffer.sequences"><tt class="xref py py-attr docutils literal"><span class="pre">sequences</span></tt></a>, <a class="reference internal" href="#VideoTester.sniffer.Sniffer.timestamps" title="VideoTester.sniffer.Sniffer.timestamps"><tt class="xref py py-attr docutils literal"><span class="pre">timestamps</span></tt></a> and <a class="reference internal" href="#VideoTester.sniffer.Sniffer.ping" title="VideoTester.sniffer.Sniffer.ping"><tt class="xref py py-attr docutils literal"><span class="pre">ping</span></tt></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#VideoTester.sniffer.Sniffer.lengths" title="VideoTester.sniffer.Sniffer.lengths"><tt class="xref py py-attr docutils literal"><span class="pre">lengths</span></tt></a>, <a class="reference internal" href="#VideoTester.sniffer.Sniffer.times" title="VideoTester.sniffer.Sniffer.times"><tt class="xref py py-attr docutils literal"><span class="pre">times</span></tt></a>, <a class="reference internal" href="#VideoTester.sniffer.Sniffer.sequences" title="VideoTester.sniffer.Sniffer.sequences"><tt class="xref py py-attr docutils literal"><span class="pre">sequences</span></tt></a>, <a class="reference internal" href="#VideoTester.sniffer.Sniffer.timestamps" title="VideoTester.sniffer.Sniffer.timestamps"><tt class="xref py py-attr docutils literal"><span class="pre">timestamps</span></tt></a> and <a class="reference internal" href="#VideoTester.sniffer.Sniffer.ping" title="VideoTester.sniffer.Sniffer.ping"><tt class="xref py py-attr docutils literal"><span class="pre">ping</span></tt></a>.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">tuple</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.ping">
<tt class="descname">ping</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.ping" title="Permalink to this definition">¶</a></dt>
<dd><p>Ping information.</p>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.play">
<tt class="descname">play</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.play" title="Permalink to this definition">¶</a></dt>
<dd><p>RTSP PLAY packet found (boolean).</p>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.ptype">
<tt class="descname">ptype</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.ptype" title="Permalink to this definition">¶</a></dt>
<dd><p>RTP payload type.</p>
</dd></dl>

<dl class="method">
<dt id="VideoTester.sniffer.Sniffer.run">
<tt class="descname">run</tt><big>(</big><em>q</em><big>)</big><a class="headerlink" href="#VideoTester.sniffer.Sniffer.run" title="Permalink to this definition">¶</a></dt>
<dd><p>Start packet sniffing and save the capture.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>q</strong> (<a class="reference external" href="http://docs.python.org/library/queue.html#Queue" title="(in Python v2.7)"><em>Queue</em></a>) &#8211; Queue to communicate with the main thread.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.sequences">
<tt class="descname">sequences</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.sequences" title="Permalink to this definition">¶</a></dt>
<dd><p>List of RTP sequence numbers.</p>
</dd></dl>

<dl class="method">
<dt id="VideoTester.sniffer.Sniffer.sniff">
<tt class="descname">sniff</tt><big>(</big><em>count=0</em>, <em>prn=None</em>, <em>lfilter=None</em>, <em>*arg</em>, <em>**karg</em><big>)</big><a class="headerlink" href="#VideoTester.sniffer.Sniffer.sniff" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">scapy.sendrecv.sniff()</span></tt> Scapy function modification. It stops when an RTSP <em>TEARDOWN</em> packet is found.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>count</strong> (<em>integer</em>) &#8211; Number of packets to capture (0 means infinite).</li>
<li><strong>prn</strong> &#8211; Function to apply to each packet. If something is returned, it is displayed.</li>
<li><strong>lfilter</strong> &#8211; Python function applied to each packet to determine if any further action is requireds.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A list of packets.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.sport">
<tt class="descname">sport</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.sport" title="Permalink to this definition">¶</a></dt>
<dd><p>RTP source port (server).</p>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.times">
<tt class="descname">times</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.times" title="Permalink to this definition">¶</a></dt>
<dd><p>List of packet arrival times.</p>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.sniffer.Sniffer.timestamps">
<tt class="descname">timestamps</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.sniffer.Sniffer.timestamps" title="Permalink to this definition">¶</a></dt>
<dd><p>List of RTP timestamps.</p>
</dd></dl>

</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/VT200x170.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="gstreamer.html"
                        title="previous chapter">3. <tt class="docutils literal docutils literal docutils literal"><span class="pre">VideoTester.gstreamer</span></tt> &#8212; Video processing with GStreamer bindings</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="video.html"
                        title="next chapter">5. <tt class="docutils literal docutils literal"><span class="pre">VideoTester.video</span></tt> &#8212; Raw and coded video manipulation</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/sniffer.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="video.html" title="5. VideoTester.video — Raw and coded video manipulation"
             >next</a> |</li>
        <li class="right" >
          <a href="gstreamer.html" title="3. VideoTester.gstreamer — Video processing with GStreamer bindings"
             >previous</a> |</li>
        <li><a href="index.html">VideoTester 0.2 documentation</a> &raquo;</li>
          <li><a href="modules.html" >Module Reference</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2013, Iñaki Úcar.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>